import { myEnv } from '@/myEnv';
import { mergeRequest } from '@/utils';

/** 修改用户信息 */
export const apiGetChageNickName = async (nickName: string) => {
    const response: MyResponse<any> = await sendRequest(nickName);
    return response;
};

const sendRequest = async (nickName: string) => {
    let response: MyResponse<any>;
    if (myEnv.IS_ON_LINE) {
        response = await mergeRequest({
            url: `user/update-info`,
            method: 'PUT',
            data: {
                nickName: nickName,
            },
        });
    } else {
        response = {
            code: '200',
            message: 'ok',
        };
    }
    return response;
};
